#pragma once

#include "CoreCommon.h"
#include "MathCommon.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Matrix4.h"

LOCO_BEGIN

/// This struct is a POD
struct LOCO_CORE_API Quaternion
{
	// Attributes
	float x, y, z, w;

	// Static constants
	static const Quaternion identity;

	// Methods
	Quaternion() = default;
	Quaternion(Quaternion const& in) = default;
	Quaternion(float x_val, float y_val, float z_val, float w_val);
	Quaternion(Vector3 const& unit_axis, float angle);
	Quaternion(Matrix4 const& rotation_matrix);
	Quaternion(Vector3 const& euler);

	Quaternion operator*(Quaternion const& in) const;

	Vector3 axis() const;
	float angle() const;
	Vector3 euler() const;
	Vector3 x_axis() const;
	Vector3 y_axis() const;
	Vector3 z_axis() const;
	Vector3 rotate(Vector3 const& in) const;
	Quaternion inverse() const;

	static bool near_equal(Quaternion const& a, Quaternion const& b, float delta = DELTA);
	static Quaternion lerp(Quaternion const& a, Quaternion const& b, float value);
	static Quaternion slerp(Quaternion const& a, Quaternion const& b, float value);
};

// inline defintions
#include "Quaternion.inl"

LOCO_END


